using MicroMsg.Storage;
using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class QQGroupListItem : UserControl
	{
		public static DependencyProperty ListItemProperty;
		internal EmojiText QGroupTxt;
		internal TextBlock QGroupNum;
		private bool _contentLoaded;
		public event ListItemClick ItemClick;
		public QGroup ItemObject
		{
			get
			{
				return (QGroup)base.GetValue(QQGroupListItem.ListItemProperty);
			}
			set
			{
				base.SetValue(QQGroupListItem.ListItemProperty, value);
			}
		}
		public QQGroupListItem()
		{
			this.InitializeComponent();
			base.SetValue(TiltEffect.IsTiltEnabledProperty, true);
		}
		private void GroupItem_Click(object sender, RoutedEventArgs e)
		{
			if (this.ItemClick != null)
			{
				this.ItemClick(this, this.ItemObject);
			}
		}
		static QQGroupListItem()
		{
			QQGroupListItem.ListItemProperty = DependencyProperty.Register("ItemObject", typeof(QGroup), typeof(QQGroupListItem), new PropertyMetadata(null, new PropertyChangedCallback(QQGroupListItem.OnItemPropertyChanged)));
		}
		private static void OnItemPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == QQGroupListItem.ListItemProperty)
			{
				(dependencyObject_0 as QQGroupListItem).OnListItemPropertyChanged(dependencyPropertyChangedEventArgs_0);
			}
		}
		private void RefreshItem(QGroup item)
		{
			if (item == null)
			{
				return;
			}
			this.QGroupTxt.Text = item.strGroupName;
			this.QGroupNum.set_Text("(" + item.nMemberNum + ")");
		}
		private void OnListItemPropertyChanged(DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			this.RefreshItem(dependencyPropertyChangedEventArgs_0.get_NewValue() as QGroup);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Common/QQInfo/UI/QQGroupListItem.xaml", 2));
			this.QGroupTxt = (EmojiText)base.FindName("QGroupTxt");
			this.QGroupNum = (TextBlock)base.FindName("QGroupNum");
		}
	}
}
